package com.srzk.youthleagueback.controller;

import com.srzk.youthleagueback.entity.po.Student;
import com.srzk.youthleagueback.entity.po.Teacher;
import com.srzk.youthleagueback.results.Result;
import com.srzk.youthleagueback.service.StudentService;
import com.srzk.youthleagueback.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/teacher")
public class TeacherController {
    @Autowired
    TeacherService teacherService;

    @RequestMapping("/update")
    public Result<Teacher> update(Teacher teacher){
        return teacherService.update(teacher);
    }
    @RequestMapping("/get")
    public Result<Teacher> get(String username){
        return teacherService.get(username);
    }

    @RequestMapping("/getList")
    public Result<List<Teacher>> getList(){
        return teacherService.getList();
    }

 /*   @RequestMapping("/delete")
    public Result<String> delete(String username){
        return teacherService.delete(username);
    }*/

    @RequestMapping("/add")
    public Result<String> getByUserName(Teacher teacher){
        return teacherService.add(teacher);
    }

}
